package com.mcxx.modules.statistics.dto;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;


@Data
public class FundPayCityStateDTO {
    private String title;
    private String areaCode;
    private String areaName;
    private List<FundpayStateDTO> fundpays;

    public FundPayCityStateDTO(String areaCode, String areaName){
        fundpays = new ArrayList<>();
        this.areaCode = areaCode;
        this.areaName = areaName;
    }

    public void addCounty(String areaCode, String areaName){
        fundpays.add(new FundpayStateDTO(areaCode, areaName));
    }

    public boolean setFundpayStatus(String areaCode, String areaName, int serial, int status){
        for(FundpayStateDTO fundpay : fundpays){
             if(fundpay.getAreaCode().equals(areaCode)) {
                 fundpay.setSerialStatus(serial, status);
                 return true;
             }
        }

        FundpayStateDTO fund = new FundpayStateDTO(areaCode, areaName);
        fund.setSerialStatus(serial, status);
        fundpays.add(fund);

        return true;
    }
}
